﻿using SnakeGame.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SnakeGame.Views
{
    /// <summary>
    /// Interaction logic for QuestionSelection.xaml
    /// </summary>
    public partial class QuestionSelection : Page
    {
        private QuestionSelectionViewModel _selectionViewModel;
        private QuestionFrame _frame;

        public QuestionSelection()
        {
            InitializeComponent();
        }

        public void Initialize(QuestionFrame questionFrame)
        {
            _frame = questionFrame;
            _selectionViewModel = new QuestionSelectionViewModel();

            DataContext = _selectionViewModel;
            _selectionViewModel.Initialize(questionFrame);

            foreach (var i in _frame.QuestionItem.QuestionList)
            {
                if (i.IsUsed)
                {
                    Button newBtn = new Button();
                    newBtn.Content = i.ID.ToString();
                    newBtn.FontSize = 40;
                    newBtn.Height = 100;
                    newBtn.CommandParameter = i.ID.ToString();
                    newBtn.Command = _selectionViewModel.StartCommand;
                    newBtn.Style = Application.Current.FindResource("RoundButtonTemplate") as Style;
                    StackButton.Children.Add(newBtn);
                }
            }
        }

    }
}
